import request from '../../utils/request'
import { NEWS_GET } from '../constants'

export const newsGetAc = (payload) => ({
  type: NEWS_GET,
  payload,
})
export const newsGet = (id) => {
  return async (dispatch) => {
    const { data } = await request.get(
      `articles?channel_id=${id}&timestamp={Date.now()}`
    )
    dispatch(newsGetAc(data.data.results))
  }
}
